package com.cn.kabalifeuser.ui.my.activity;

import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;

import com.cn.kabalifeuser.R;
import com.cn.kabalifeuser.base.IBaseActivity;
import com.cn.kabalifeuser.config.LoginHelper;
import com.cn.kabalifeuser.ui.my.bean.IntegralRuleBean;
import com.cn.kabalifeuser.utils.RxToast;
import com.zzhoujay.richtext.RichText;

import butterknife.BindView;

/**
 * Created by 晓林 on 2020/9/10.
 * function: 积分规则
 */
public class IntegralRuleActivity extends IBaseActivity<IntegralRuleView, IntegralRulePresenter> implements IntegralRuleView {


    @BindView(R.id.tv_details)
    TextView tvDetails;

    @Override
    protected IntegralRulePresenter createPresenter() {
        return new IntegralRulePresenter();
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_h5;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        super.initView(savedInstanceState);
        setTitleBar("积分规则说明");

        mPresenter.onIntegralRuleData();
    }

    @Override
    public void onReLoggedIn(String msg) {
        RxToast.error(msg);
        LoginHelper.againGoToLoginActivity(getMe());
    }

    @Override
    public void onError(String msg) {
        RxToast.error(msg);
    }

    @Override
    public Context _getContext() {
        return null;
    }

    @Override
    public void onIntegralRuleSuccess(IntegralRuleBean bean) {
        RichText.from(bean.getResult().getIntegral()).autoFix(false).showBorder(false).autoPlay(true).into(tvDetails);
    }
}
